
#include "PowerAdapter.h"

PowerAdapter::PowerAdapter(Generator* g)
    : gen_(g) {}

void PowerAdapter::Input(Generator* c)
{
  if (gen_ != c) {
    delete gen_;
    gen_ = c;
  }
}

Current* PowerAdapter::Output()
{
  Current* c = gen_->Generate();
  // ...
  c->set_volt(36);
  c->set_type("交流电");
  // ...
  return c;
}

PowerAdapter::~PowerAdapter()
{
  delete gen_;
  gen_ = nullptr;
}
